<?php
namespace app\common\model;

use think\Config;
use think\Db;
use think\Model;

class User extends Model{


    protected $table = "jiujiu_user";
    /*
    * 获取带等级的所有数据
    * */
    public function getMyTeam($uid){

        $users =$this->get_list($this->where('puid',$uid)->select());
        return $users;
    }



    public  function get_list($arr){
        //$arr 所有分类列表
        static $user_list = array() ;
        foreach($arr as $u){
            //看下面有没有子类
            $user_list[] = $u;
            $children = $this->where('puid',$u['uid'])->select();
            if($children){
                $this->get_list($children);
            }
        }
        return $user_list;
    }




}